import Vue from "vue";
import VueRouter from "vue-router";
import routes from "./routes";
Vue.use(VueRouter);
//this.$router.push调用的就是下面这个方法
// VueRouter.prototype.push
const pushRouter = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onComplete, onAbort) {
  if (!onComplete && !onAbort) {
    return pushRouter.call(this, location).catch((error) => error);
  } else {
    return pushRouter.call(this, location, onComplete, onAbort);
  }
};
const router = new VueRouter({
  mode: "history",
  routes: routes,
});
export default router;
